package com.lemeng.message;

import com.alibaba.fastjson.JSONObject;
import com.lemeng.util.SmsUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

public class MyMessageConsumer implements MessageListener {
    @Override
    public void onMessage(Message message) {
        String mapStr = new String(message.getBody());
        JSONObject jsonObject = JSONObject.parseObject(mapStr);
        Object phone = jsonObject.get("phone");
        Object code = jsonObject.get("code");

        SmsUtil.send(jsonObject.get("phone").toString(),jsonObject.get("code").toString());
    }
}
